package org.lys.controller;

import org.lys.model.Admin;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.net.BindException;

@RestController
@RequestMapping("/test")
public class DemoController {

    @Autowired
    private Environment testEnvironment;

    @GetMapping
    public String getString(@RequestBody @Valid Admin admin) {
        System.out.println(admin);
        return testEnvironment.getProperty("server.port");
    }

    @GetMapping("demo")
    public String demo() {
        int num=10/0;
        return "demo";
    }
}
